a[20][20],b[20][20];main(i,j,t){for(j=0;j<20;j++)for(i=0;i<20;scanf("%d",&a[i++][j]));for(j=0;j<17;j++)for(i=0;i<20;i++)b[i][j]=a[i][j]*a[i][j+1]*a[i][j+2]*a[i][j+3];for(j=0;j<20;j++)for(i=0;i<17;b[i][j]=t>b[i][j]?t:b[i][j],i++)t=a[i][j]*a[i+1][j]*a[i+2][j]*a[i+3][j];for(j=0;j<17;j++)for(i=0;i<17;b[i][j]=t>b[i][j]?t:b[i][j],i++)t=a[i][j]*a[i+1][j+1]*a[i+2][j+2]*a[i+3][j+3];for(j=0;j<17;j++)for(i=0;i<17;b[i][j]=t>b[i][j]?t:b[i][j],i++)t=a[i+3][j]*a[i+2][j+1]*a[i+1][j+2]*a[i][j+3];for(t=i=0;i<20;i++)for(j=0;j<20;j++)t=t>b[i][j]?t:b[i][j];printf("%d",t);}
